/*!
// Testweb v0.4.0
// http://or-change.cn
// Copyright 2014 OrChange Inc. All rights reserved.
// Licensed under the GPL License.
*/

/**
 * As the execution conditions of the EventStep.
 * @module Condition
 * @requires OC
 * @example
 *     var Condition = require("./oc.condition"); //How to require Condition module.
 */
define(function (require, exports, module) {
	'use strict';
	var OC = require("lib/core/oc"),
		$ = require("lib/jquery/jquery"),
		Condition;
	/**
	 * As the execution conditions of the EventStep.
	 *
	 * @class Condition
	 * @constructor
	 * @param object {string} CSSpath string of object.
	 */
	Condition = function Condition(object) {
		/**
		 * The object(HTMLElement) to check. The param is CSSPath.
		 * @property object
		 * @type string
		 */
		this.object = object;
	};
	/**
	 * Test if the object existed.
	 * @method test
	 * @returns {boolean} The object is existed?
	 */
	Condition.prototype.test = function () {
		return ($(this.object, window[0].document).length > 0);
	};
	/**
	 * Override default toString.
	 * @method toString
	 * @returns {string} The CSSPath string of object.
	 */
	Condition.prototype.toString = function () {
		return this.object;
	};

	return Condition;
});